import React, { useRef } from 'react'
import { Modal, Form, Input, Select } from 'antd'
const { Item } = Form
const { Option } = Select

function Main ({ visible = false, onFinish = () => {}, hide = () => {} }) {
  const formRef = useRef(null)
  return (
    <Modal
      title='添加自定义送达'
      open={visible}
      onOk={() => formRef.current.submit()}
      onCancel={hide}
      maskClosable={false}
      destroyOnClose
    >
      <Form name='add-other-service' ref={formRef} onFinish={d => onFinish(d)}>
        <Item name='name' label='送达名称' rules={[{ required: true, message: '送达名称不能为空' }]}>
          <Input placeholder='请输入送达名称' />
        </Item>
        <Item name='type' label='送达类型' rules={[{ required: true, message: '送达类型不能空' }]}>
          <Select placeholder='请选择送达类型'>
            <Option value='自定义送达'>自定义送达</Option>
            <Option value='仲裁员送达'>仲裁员送达</Option>
          </Select>
        </Item>
      </Form>
    </Modal>
  )
}

export default Main
